<template>
  <el-button text @click="dialogVisible = true"> click to open the Dialog appendToBody </el-button>

  <v-window v-model="dialogVisible" :mask="true" appendToBody title="Tips before-close" width="30%">
    <span>This is a message</span>
    <template #footer>
      <span class="dialog-footer">
        <el-button @click="dialogVisible = false">Cancel</el-button>
        <el-button type="primary" @click="dialogVisible = false"> Confirm </el-button>
      </span>
    </template>
  </v-window>
</template>

<script lang="ts" setup>
  import { ref } from 'vue'
  import { ElOverlay, ElMessageBox } from 'element-plus'

  const dialogVisible = ref(false)

  const handleClose = (done: () => void) => {
    ElMessageBox.confirm('Are you sure to close this dialog?')
      .then(() => {
        done()
      })
      .catch(() => {
        // catch error
      })
  }
</script>
<style scoped>
  .dialog-footer button:first-child {
    margin-right: 10px;
  }
</style>
